var module = angular.module('app.directives', []);
// module.directive('hideTabs', function ($rootScope) {
//     return {
//         restrict: 'A',
//         link: function(scope, element, attributes) {
//             scope.$on('$ionicView.beforeEnter', function() {
//                 if (attributes.hideTabs==true) {
//                     $rootScope.hideTabs =true;
//                 }
//                 scope.$watch(attributes.hideTabs, function(value){
//                     $rootScope.hideTabs = value;
//                 });
//             });

//             scope.$on('$ionicView.beforeLeave', function() {
//                 $rootScope.hideTabs = false;
//             });
//         }
//     };
// })

module.directive('showTabs', function ($rootScope) {
    return {
        restrict: 'A',
        link: function ($scope, $el) {
            $rootScope.hideTabs = false;
        }
    };
}).directive('hideTabs', function ($rootScope) {
    return {
        restrict: 'A',
        link: function (scope, element, attributes) {
            $rootScope.hideTabs = true;
         scope.$on('$ionicView.beforeLeave', function() {
                 $rootScope.hideTabs = false;
             });
        }
    };
})